package design.memento;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by admin on 2019/3/28.
 */
public class EmpMemento {
    private int anchor = 0;
    List<Memento> mementoList = new ArrayList<>();
    void memento(Memento memento){
        mementoList.add(memento);
        anchor = mementoList.size();
        System.out.println(anchor);

    }
    Memento recovery(){
        Memento memento = mementoList.get((anchor-1));
        System.out.println((anchor));
        return memento;

    }

}
